#ifndef DESIGNEXTRACTOR_H
#define DESIGNEXTRACTOR_H

#include <list>
#include <vector>

#include "AST.h"
#include "TNode.h"
#include "spa_types.h"

class DesignExtractor
{
	private:
		
		// Current procedure extractor is working on
		TNODE* _procedure;

		// Stores latest parent node
		std::vector<TNODE*> _parent;

		void HandleProcedure( TNODE* node );

		void HandleCall( TNODE* node );
		void HandleIf( TNODE* node );
		void HandleWhile( TNODE* node );
		void HandleAssign( TNODE* node );
		
		void HandleStatement( TNODE* node );
		void HandleStatementList( TNODE* node );

		STMT STMTFromTNode( TNODE* node );

		// Traverse expression tree to get all unique variables for Uses relation.
		VARINDEX_ARRAY FindVariablesInExpressionTree( TNODE* node );
		VARINDEX_ARRAY FindVariablesInExpressionTreeHelper( TNODE* node );
		// Traverse expression tree to get all unique constants for Shortcut Table.
		INTEGER_ARRAY FindConstantsInExpressionTree( TNODE* node );
		INTEGER_ARRAY FindConstantsInExpressionTreeHelper( TNODE* node );

	public:
		DesignExtractor();
		~DesignExtractor();
		
		void ExtractDesign();

};

#endif